package com.bjdd.jdy.ui.map;

import com.baidu.location.BDLocation;
import com.bjdd.jdy.Constant;
import com.bjdd.jdy.baidu.LocationUtils;
import com.bjdd.jdy.util.JumpUtil;
import com.bjdd.jdy.util.L;
import com.bjdd.jdy.util.SpUtil;

import rx.functions.Action1;


/**
 * Created by Administrator on 2017/4/14.
 */

public class MapPresenter extends MapContract.Presenter {
    @Override
    public void onStart() {
        if (SpUtil.getUser() == null || SpUtil.getUser().equals("") || SpUtil.getUser().getCarrierId() == null) {
            JumpUtil.toLogin(context);
            return;
        }
        LocationUtils.getInstance(context).start();
        rxManager.on(Constant.EVENT_LOCATION, new Action1<Object>() {
            @Override
            public void call(Object o) {
                BDLocation bdLocation = (BDLocation)o;
                view.LocationBack(bdLocation);
                L.d("rx定位："+bdLocation.getTime());
            }
        });
    }
}
